#@adminLayout()

#define main()
<div class="jfa-header-box" id="jfa-header-box">
    <div class="jfa-crumbs" id="jfa-crumbs">
        文章管理
    </div>
    <div class="jfa-search-box"></div>
    #include("/_view/_admin/common/_header_right.html")
</div>

### 内容区域
<div class="jfa-content-box" id="jfa-content-box">
    <div class="jfa-content" id="jfa-content">
        <div  style="float: left;width: 99%;margin-top: 16px;">
            <div>
                <a class="btn btn-info btn-sm" href="/admin/article/add">
                    <i class="fa fa-plus"></i>
                    新增文章
                </a>
            </div>
            <hr style=" height:1px;border:none;border-top:#cccccc 1px dashed;margin: 10px 0 10px 0">
            <row>
                <div class="col-md-6" style="padding-left: 0px">
                    <div class="form-group margin-bottom-20">

                                <div class="btn-group btn-group-sm" data-toggle="buttons">
                                    <label class="btn btn-default">
                                        <input id="ck_top" type="checkbox" autocomplete="off"> 固顶
                                    </label>
                                    <label class="btn btn-default">
                                        <input id="ck_push" type="checkbox" autocomplete="off"> 推荐
                                    </label>
                                    <label class="btn btn-default">
                                        <input id="ck_hot" type="checkbox" autocomplete="off"> 热门
                                    </label>
                                </div>
                                <div class="btn-group ">
                                    <select class="form-control select-title-bar" name="article.mediaId" class="related-project-name " >
                                        <option >选择类型</option>
                                    </select>
                                </div>
                                <div class="btn-group ">
                                    <select class="form-control select-title-bar" name="article.mediaId" class="related-project-name" >
                                        <option >选择状态</option>
                                    </select>
                                </div>
                    </div>
                </div>
                <div class="col-md-6" style="padding-left: 0px;display: inline;float: right;text-align: right">
                    <div class="form-group margin-bottom-20 input-group-sm" id="div_out_link" style="display: inline-block" >
                        <input type="text"  class="form-control" style="width: 150px" name="article.mainTitle" placeholder="标题" />
                    </div>
                    <div class="form-group margin-bottom-20 input-group-sm" id="div_out_link" style="display: inline-block" >
                        <input type="text"  class="form-control" style="width: 150px" name="article.mainTitle" placeholder="来源" />
                    </div>
                    <div class="btn-group" style="margin-left: 16px">
                        <a class="btn btn-info btn-sm" id="button-search">
                            <i class="glyphicon glyphicon-search"></i>
                            查询
                        </a>
                    </div>
                </div>
            </row>
        </div>

        <div class="jfa-table-box margin-top-30">
            <table class="table table-bordered table-hover margin-bottom-10">
                <thead>
                <tr>
                    <th><input type="checkbox"></th>
                    <th>id</th>
                    <th>标题</th>
                    <th>置顶</th>
                    <th>来源</th>
                    <th>点击</th>
                    <th>发布日期</th>
                    <th>状态</th>
                    <th>锁定</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                #for(x : articlePage.getList())
                <tr>
                    <th scope="row"><input type="checkbox"></th>
                    <th scope="row">#(x.id)</th>
                    <td>
                        <a href="/article/#(x.id)" target="_blank">#(x.mainTitle)</a>
                    </td>
                    <td>#(x.isTop)</td>
                    <td>
                        <a href="/article/#(x.id)" target="_blank">#(x.mediaName)</a>
                    </td>
                    <td>#(x.redNumber)</td>
                    <td>#date(x.createDate)</td>
                    <td>#(x.auditState)</td>
                    <td>
                        #set(locked = x.isLock > 0)
                        <input data-id="#(x.id)"
                               #if(locked) checked #end

                               type="checkbox" class="mgc-switch mgc-tiny">
                    </td>

                    <td class="jfa-operation-button">
                        <a href="/admin/article/edit?id=#(x.id)&p=#(articlePage.pageNumber)">
                            <i class="fa fa-pencil" title="修改"></i>
                        </a>

                        <a data-delete
                           data-title="#escape(x.mainTitle)"
                           data-action="/admin/article/delete?id=#(x.id)">
                            <i class="fa fa-trash" title="删除"></i>
                        </a>

                        <a data-pjax href="/admin/article/getReplyList?mediaId=#(x.id)">
                            <i class="fa fa-reply" title="回复管理"></i>
                        </a>

                    </td>
                </tr>
                #end
                </tbody>
            </table>

            <div>
                #@adminPaginate(articlePage.pageNumber, articlePage.totalPage, "/admin/article?p=")
            </div>
        </div>
    </div><!-- END OF jfa-content -->
</div><!-- END OF jfa-content-box -->

<style type="text/css">
</style>
<script type="text/javascript">
    $(document).ready(function() {
        initMagicInput(prepareAction);

        $('#button-search').click(function(){
            loadData();
        });

        $("#ck_top").change(function() {
            var _show = $("#ck_top").prop("checked")
            loadData();
        });

    });

    function prepareAction($this, state) {
        return {
            url: state ? "/admin/article/lock" : "/admin/article/unlock",
            data : {
                id: $this.attr("data-id")
            }
        }
    }
    
    function loadData() {
        //判断参数

        window.location.replace("/admin/article?dasdasd")
    }

</script>
#end




